Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to reject update and revert operations if there are any file conflicts #714

Merged
merged 3 commits into from
Oct 15, 2024

Conversation

spyrkob
Copy link
Collaborator

@spyrkob spyrkob commented Jul 4, 2024

Add --no-conflicts-only argument to update and revert operations.

When --no-conflicts-only argument is present, the apply and perform operations should fail if any file conflicts are detected. An error code (1) should be returned and no changes to the installation should be applied.

Requires wildfly-extras/wildfly-installation-manager-api#20

@spyrkob
Copy link
Collaborator Author

spyrkob commented Jul 4, 2024

@yersan this adds an option to reject the update/revert if any file conflicts are detected, like we talked last week.

@yersan
Copy link
Contributor

yersan commented Jul 4, 2024

@spyrkob Question, as long as there is a deployment, the standalone.xml / domain.xml will be modified; it means that practically 100% of the installations will generate a conflict when copying these configuration files (and other files used to tweak the launch script environment).

How does Prospero work in that regard? I mean, if the update does not contain any configuration file change (as it should be), would a conflict be detected always when the full structure of the candidate server is applied?

If so, it sounds reasonable to exclude from the conflict checks the files that are expected can be modified by the user. So, even if --no-conflicts-only is used and there is a conflict on standalone.xml / domain.xml, then they will be ignored because the conflict is expected on some files.

It would be great if we have the possibility to just check the conflicts by using a candidate server without the apply or perform actions. The advantage would be that will allow the users to check possible conflicts without stopping the server first, and then decide if they want to continue. There won't be guarantees to not hit a conflict later, but if you, before shutting down the server, are able to check the conflicts, then an immediate shutdown to apply the update would be safer and would avoid shutting down from update later because you have a conflict you want to investigate or be sure it is safe for you.

@spyrkob
Copy link
Collaborator Author

spyrkob commented Jul 5, 2024

How does Prospero work in that regard? I mean, if the update does not contain any configuration file change (as it should be), would a conflict be detected always when the full structure of the candidate server is applied?

The conflicts only occur if both the user and the incoming update changes the same file. If only the user changed a file, this file will be preserved. If only the update modified the file, the file will be updated. If the file was modified in both, the resolution via .glold/.glnew will be done.

It would be great if we have the possibility to just check the conflicts by using a candidate server without the apply or perform actions. The advantage would be that will allow the users to check possible conflicts without stopping the server first, and then decide if they want to continue. There won't be guarantees to not hit a conflict later, but if you, before shutting down the server, are able to check the conflicts, then an immediate shutdown to apply the update would be safer and would avoid shutting down from update later because you have a conflict you want to investigate or be sure it is safe for you.

Sure we can add a method like checkCandidate that will check if it can be applied, what artifacts are updated, if there are any FileConflicts, etc. Not sure if that's also needed on command line, but if so we can add a new subcommand like update check-candidate

@yersan
Copy link
Contributor

yersan commented Jul 5, 2024

Not sure if that's also needed on command line

At Prospero command line, it could be useful if you are trying to minimize the downtime and you want to reject any conflicts.
It would be as a check before stopping the server to apply the generated candidate server to be sure that what you want to apply won't be rejected if there are conflicts.

@spyrkob
Copy link
Collaborator Author

spyrkob commented Jul 5, 2024

I'll add this functionality to this PR next week

@spyrkob spyrkob force-pushed the no_conflicts_option branch 2 times, most recently from cfeaa2c to cb15571 Compare July 12, 2024 15:10
@spyrkob
Copy link
Collaborator Author

spyrkob commented Jul 12, 2024

@yersan FYI I added a verifyCandidate that check if the candidate is valid (i.e. if it is a candidate for the desired opertion, if it can be applied etc) and returns a list if file conflicts together with their proposed resolutions.

@spyrkob spyrkob merged commit 234a9cd into wildfly-extras:main Oct 15, 2024
7 checks passed
@spyrkob spyrkob deleted the no_conflicts_option branch October 15, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants